package main

import (
	"fmt"
	"sync"
)

func main() {
	var wg sync.WaitGroup

	f := func(num int) {
		defer wg.Done()
		for i := 0; i < 5; i++ {
			fmt.Printf("第%v个协程执行--%v\n", num, i)
		}
	}
	// 多协程并发执行
	for i := 0; i < 3; i++ {
		wg.Add(1)
		go f(i + 1)
	}
	wg.Wait()
}
